home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / GMS / Source / C / Fading / WhiteFade.c < prev   
Encoding:
C/C++ Source or Header  |  1997-05-04  |  1.5 KB  |  58 lines

  1. /*
  2. ** AGA WhiteFade Demo
  3. ** ------------------
  4. ** There are three examples of fading in this program:  ColourMorph(),
  5. ** ColourToPalette(), and PaletteToColour().
  6. **
  7. ** To compile with SAS/C
  8. **  1> sc WhiteFade.c link startup=LIB:gms.o data=far
  9. **
  10. */
  11.  
  12. #include <proto/games.h>
  13.  
  14. extern struct GMSBase *GMSBase;
  15. ULONG _XCEXIT = NULL;
  16. APTR PREFSNAME = DEFAULT;
  17.  
  18. void main(void)
  19. {
  20.   UWORD FadeState = 0;
  21.   struct GameScreen *GameScreen;
  22.   struct Picture *Picture;
  23.  
  24.   if (Picture = LoadPicFile("GMS:demos/data/PIC.Loading",GETPALETTE|VIDEOMEM)) {
  25.  
  26.      if (GameScreen = AddScreenTags(TAGS_GAMESCREEN,NULL,
  27.         GSA_MemPtr1,Picture->Data,
  28.         GSA_ScrWidth,320,
  29.         GSA_ScrHeight,256,
  30.         GSA_AmtColours,Picture->AmtColours,
  31.         GSA_PicWidth,Picture->Width,
  32.         GSA_PicHeight,Picture->Height,
  33.         GSA_Planes,Picture->Planes,
  34.         GSA_ScrMode,Picture->ScrMode,
  35.         GSA_ScrType,Picture->ScrType,
  36.         TAGEND)) {
  37.  
  38.         ShowScreen(GameScreen);
  39.  
  40.         do { WaitVBL();
  41.              FadeState = ColourMorph(GameScreen,FadeState,10,0,32,0x000000,0xFFFFFF);
  42.         } while (FadeState != NULL);
  43.  
  44.         do { WaitVBL();
  45.              FadeState = ColourToPalette(GameScreen,FadeState,2,0,32,Picture->Palette,0xFFFFFF);
  46.         } while (FadeState != NULL);
  47.  
  48.         do { WaitVBL();
  49.              FadeState = PaletteToColour(GameScreen,FadeState,2,0,32,Picture->Palette,0x000000);
  50.         } while (FadeState != NULL);
  51.  
  52.         FreePic(Picture);
  53.      }
  54.   DeleteScreen(GameScreen);
  55.   }
  56. }
  57.  
  58.